<?php

declare(strict_types=1);

namespace SixShop\Wangdian\Services;

use SixShop\Wangdian\Response\ApiResponse;

/**
 * Refund service for refund processing, etc.
 */
class RefundService extends BaseService
{
    /**
     * Query refund information
     */
    public function query(array $params = []): ApiResponse
    {
        return $this->call('refund_query.php', $this->filterParams($params));
    }

    /**
     * Push sales refund
     */
    public function pushSalesRefund(array $refundData): ApiResponse
    {
        $this->validateRequired($refundData, ['refund_list']);

        return $this->call('sales_refund_push.php', [
            'refund_list' => $this->encodeIfArray($refundData['refund_list']),
        ]);
    }

    /**
     * Push stockin refund
     */
    public function pushStockinRefund(array $refundData): ApiResponse
    {
        return $this->call('stockin_refund_push.php', 
            $this->filterParams($refundData)
        );
    }

    /**
     * Query stockin refund
     */
    public function queryStockinRefund(array $params = []): ApiResponse
    {
        return $this->call('stockin_refund_query.php', $this->filterParams($params));
    }
}